package com.lsh.payment.core.model.payenum;

import lombok.Getter;

/**
 * Project Name: lsh-payment
 *
 * @author peter
 * @date 19/10/26
 * 北京链商电子商务有限公司
 * Package
 * desc:
 */
@Getter
public enum TradeType {
    /**
     *
     */
    ALIAPP(1, "AliApp", 1, "alipay", 1),
    WXAPP(2, "WxApp", 2, "wxpay", 2),
    ALIH5(3, "AliH5", 1, "alipay", 1),
    WXH5(4, "WxH5", 2, "wxpay", 2),
    LKL(5, "Lkl", 5, "lklpay", 5),
    QFWXSM(6, "WxSm", 6, "qfpay", 6),
    DMALLPAY(7, "DmallPay", 7, "dmallpay", 7),
    QFALISM(8, "AliSm", 6, "qfpay", 8),
    PURSE_ON_CREDIT_PAY(9, "purse_on_credit_pay", 9, "purse_on_credit_pay", 9),
    PURSE_BALANCE_PAY(10, "purse_balance_pay", 10, "purse_balance_pay", 10),
    PURSE_PRE_PAY(11, "purse_pre_pay", 11, "purse_pre_pay", 11),
    ALLINWXSM(15, "WxSm", 18, "allinpay", 6),
    ALLINALISM(16, "AliSm", 18, "allinpay", 8),
    CMWXSM(17, "WxSm", 21, "cmpay", 6),
    CMALISM(18, "AliSm", 21, "cmpay", 8),
    ALLINWXBSM(19, "AllinWxBsm", 18, "allinpay", 6),
    ALLINALIBSM(20, "AllinAliBsm", 18, "allinpay", 8),
    WXBSM(21, "WxBsm", 2, "wxpay", 6),
    ALIBSM(22, "AliBsm", 1, "alipay", 8),
    WXXCX(23, "Wxxcx", 20, "wxpaygroupon", 23);

    private int code;

    private String name;

    private int channelCode;

    private String channelName;

    private int method;

    TradeType(int code, String name, int channelCode, String channelName, int method) {
        this.code = code;
        this.name = name;
        this.channelCode = channelCode;
        this.channelName = channelName;
        this.method = method;
    }

    public static String getTradeTypeByCode(int code) {
        for (TradeType tradeType : TradeType.values()) {
            if (tradeType.getCode() == code) {
                return tradeType.getName();
            }
        }

        return null;
    }

    public static TradeType paseTradeTypeByCode(int code) {
        for (TradeType tradeType : TradeType.values()) {
            if (tradeType.getCode() == code) {
                return tradeType;
            }
        }

        return null;
    }

}
